
cmake_minimum_required(VERSION 3.20)

project(main)

add_executable(main main.cpp)

target_compile_definitions(main PUBLIC 
#    $<1:CMAKE_GENERATOR_EXPRESSION=1>
#    $<1:CMAKE_GENERATOR_EXPRESSION="$<CONFIG>">
#    $<1:CMAKE_GENERATOR_EXPRESSION="$<PLATFORM_ID>">
#    $<1:CMAKE_GENERATOR_EXPRESSION="$<C_COMPILER_ID>">
    $<1:CMAKE_GENERATOR_EXPRESSION="$<CXX_COMPILER_ID>">
)

add_custom_target(target
        COMMAND
        ${CMAKE_COMMAND} -E echo "$<CONFIG>"

        COMMAND
        ${CMAKE_COMMAND} -E echo  "condition: $<$<CONFIG:Debug>:Debug Mode>"

        COMMAND
        ${CMAKE_COMMAND} -E echo "IF: $<IF:$<CONFIG:Debug>,Debug Mode,Release Mode>"

        COMMAND
        ${CMAKE_COMMAND} -E cmake_echo_color --cyan "Compilation is over!"
)

add_dependencies(main target)